package day46_746;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName Solution
 * @Description TODO
 * @Author clockTown
 * @Date 2021/6/24 20:57
 * @Version 1.0
 */
public class Solution {
    public int minCostClimbingStairs(int[] cost) {

        int n = cost.length;

        List<Integer> res = new ArrayList<>();
        res.add(0);
        res.add(0);
        for (int i = 2; i <= n; i++) {
            res.add(Math.min(res.get(i - 1) + cost[i - 1], res.get(i - 2) + cost[i - 2]));
        }
        return res.get(n);
    }

    public static void main(String[] args) {
        int[] cost = {
            10,15,20
        };
        System.out.println(new Solution().minCostClimbingStairs(cost));
    }
}
